<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%--
  Created by IntelliJ IDEA.
  User: owner
  Date: 2018-08-09
  Time: 23:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<div class="orderObject">
    <c:forEach items="${orders}" var="order" varStatus="st">
        <div order="${order.status}" class="orderObject_myobject">
            <div class="orderObject_myobjectBorder">
                <table>
                    <tr class="myobject_bar">
                        <td class="myobject_orderNumber" colspan="2" >
                            <span class="myobject_orderTime">${order.createDateDesc}</span>
                            <span class="myobject_orderNum">订单号: ${order.orderCode}</span>
                        </td>
                        <td class="myobject_orderImg1">
                            <img src="img/site/confirmOrderTmall.png" alt="">
                            <span>天猫商城</span>
                        </td>
                        <td></td>
                        <td class="myobject_orderImg2">
                            <a href="#no">
                                <img src="img/site/wangwang.gif" alt="">
                            </a>
                        </td>
                        <td class="myobject_orderDelete">
                            <a href="foredeleteOrder?oid=${order.id}">
                                <span class="glyphicon glyphicon-trash pull-right"></span>
                            </a>
                        </td>
                    </tr>
                    <c:forEach items="${order.orderItems}" var="item" varStatus="st">
                        <tr class="myobject_object">
                            <td class="myobject_objectImg">
                                <img src="img/productSingle_middle/${item.product.firstProductImage.id}.jpg" alt="">
                            </td>
                            <td class="myobject_objectName">
                                <span class="myobject_objectTitle"><a href="foreproduct?pid=${item.product.id}">${item.product.name}</a></span>
                                <span class="myobject_objectImgs">
                        <img title="支持信用卡支付" src="img/site/creditcard.png">
                        <img title="消费者保障服务,承诺7天退货" src="img/site/7day.png">
                        <img title="消费者保障服务,承诺如实描述" src="img/site/promise.png">
                </span>
                            </td>
                            <td class="myobject_objectPrice">
                                <span class="myobject_objectOrign">￥${item.product.orignalPrice}</span>
                                <span class="myobject_objectNow">￥${item.product.promotePrice}</span>
                            </td>
                            <td class="myobject_objectNum">
                                <span class="myobject_objectNumber">${item.number}</span>
                            </td>
                            <c:if test="${st.index==0}">
                                <td class="myobject_objectAccount" rowspan="${fn:length(order.orderItems)}">
                                    <span class="myobject_objectNowAccount">￥${order.total}</span>
                                    <span>(含运费：￥0.00)</span>
                                </td>
                            </c:if>
                                <c:choose>
                                    <c:when test="${fn:contains(order.status,'Review')}">
                                        <td class="myobject_objectModify">
                                            <a href="foreaccess?oiid=${item.id}"><button class="myobject_object${order.status}">${order.statusDesc}</button></a>
                                        </td>
                                    </c:when>
                                    <c:otherwise>
                                        <c:if test="${st.index==0}">
                                        <td class="myobject_objectModify" rowspan="${fn:length(order.orderItems)}">
                                            <c:choose>
                                                <c:when test="${fn:contains(order.status,'Delivery')}">
                                                    <span>${order.statusDesc}</span>
                                                    <br>
                                                    <button class="myobject_object${order.status}">催卖家发货</button>
                                                </c:when>
                                                <c:when test="${fn:contains(order.status,'Pay' )}">
                                                    <a href="forepay?oid=${order.id}"><button class="myobject_object${order.status}">${order.statusDesc}</button></a>
                                                </c:when>
                                                <c:when test="${fn:contains(order.status,'Confirm')}">
                                                    <a href="foreconfirm?oid=${order.id}"> <button class="myobject_object${order.status}">${order.statusDesc}</button></a>

                                                </c:when>
                                                <c:otherwise></c:otherwise>
                                            </c:choose>
                                        </td>
                                        </c:if>
                                    </c:otherwise>
                                </c:choose>
                        </tr>
                    </c:forEach>
                </table>
            </div>
        </div>
    </c:forEach>

</div>
